using System.Data.Entity.ModelConfiguration;
using Abmemunit.Domain.Users;

namespace Abmemunit.Data.Mapping.Users
{
    /// <summary>
    /// UserMap configuration class
    /// </summary>
    public partial class UserMap : EntityTypeConfiguration<User>
    {
        /// <summary>
        /// Ctor
        /// </summary>
        public UserMap()
        {
            this.ToTable("User");
            this.HasKey(c => c.Id);
            this.Property(u => u.Username).HasMaxLength(1000);
            this.Property(u => u.Email).HasMaxLength(1000);
            this.Property(u => u.Password);

            this.Ignore(u => u.PasswordFormat);

            this.HasMany(c => c.UserRoles)
                .WithMany()
                .Map(m => m.ToTable("User_UserRole_Mapping"));


        }
    }
}